<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8" />
<title>排期查询</title>
<link rel="stylesheet" type="text/css" href="../Public/jquery-easyui-1.3.4/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../Public/jquery-easyui-1.3.4/themes/icon.css">
<script type="text/javascript" src="../Public/jquery-easyui-1.3.4/jquery.min.js"></script>
<script type="text/javascript" src="../Public/jquery-easyui-1.3.4/jquery.easyui.min.js"></script>
<script type="text/javascript">
$.fn.datebox.defaults.formatter = function(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y+'-'+(m<10?'0'+m:m)+'-'+(d<10?'0'+d:d);
};
$(document).ready(function(){
//#################初始化排期列表##########################
	$('#mytable').datagrid({
		url:'index.php?s=/Addate/indexjson',
		frozenColumns:[[
			{field:'table_channel',title:'频道',width:100,align:"left"},
			{field:'table_adplace',title:'广告位',width:150,align:"left"},
			{field:'table_adplace_w_h',title:'尺寸（宽*高）',width:100,align:"center",formatter:function(value){
				return value.w+'px*'+value.h+'px';
			}},
			{field:'table_status',title:'状态',width:80,align:"center",formatter:function(value){
				if(value=='1'){
					return '<font color=red>删除</font>';
				}else if(value=='2'){
					return '<font color=#FFCC00>禁用</font>';
				}else{
					return '正常';
				}
			}}
		]],
		columns:[[<?php
			if($yearyue_a){
				echo implode(',',$yearyue_a);
			}
			?>],[<?php
			if($ri_a){
				echo implode(',',$ri_a);
			}
			?>]],
		singleSelect:true,
		fit:true,
		pageSize:40,
		pagination:true
	});
//#################初始化频道选择树##########################
	$('#searchchannelid').combotree({
		width:162,
		treeWidth:160,
		treeHeight:400,
		url:'index.php?s=/Channel/treejson'
	});
});
//#################订单列表系列函数##########################
function searchres(){	//订单查询程序
	var searchchannelid = $('#searchchannelid').combotree('getValue');
	$("#s_c_id").val(searchchannelid);
	var searchstartdate = $("#searchstartdate").datebox("getValue"); 
		//$("#searchstartdate").datebox("setValue", searchstartdate); 
	var searchenddate = $("#searchenddate").datebox("getValue");
		//$("#searchenddate").datebox("setValue", searchenddate); 
	if(searchstartdate && searchenddate){
		if(parseInt(searchenddate)<parseInt(searchstartdate)){
			$.messager.alert('错误消息','开始时间必须小于结束时间！','error');return false;
		}
	}else{
		$.messager.alert('错误消息','请选择开始时间与结束时间！','error');return false;
	}
	$("#myForm").submit();
}
function undo(){	//查询参数重置
	$('#searchchannelid').combotree('setValue',{
		id:0,
		text:'顶级频道'
	});
	$("#searchstartdate").val('');
	$("#searchenddate").val('');
	$("#searchtypeid").val('0');
}
function excel(type){	//导出到excel
	var page = 0;
	var rows = 0;
	
	// 本页导出
	if(type=='2'){
		page = $("#mytable").datagrid('options').pageNumber;
		rows = $("#mytable").datagrid('options').pageSize;
	}
	window.open("excel.php?searchchannelid=&searchstartdate=&searchenddate=&searchtypeid=0&page="+page+'&rows='+rows,'_self');
}
</script>
</head>
<body class="easyui-layout">
<div region="center" title="排期设置-&gt;排期查询">
<div class="easyui-layout" fit="true">
	<div region="north" border="false" style="height:40px;padding:2px;padding-left:5px;background-color:#DFE8F6;font-size:11px;color:#15428B;">
	<table>
	<FORM METHOD=POST ACTION="index.php?s=/Addate/index" id="myForm">
	<INPUT TYPE="hidden" name="s_c_id" id="s_c_id">
	<tr><td>频道：</td><td><SELECT NAME="searchchannelid" id="searchchannelid"></SELECT></td>
	<td>开始时间：</td><td><input TYPE="text" NAME="searchstartdate" id="searchstartdate" style="width:100px" class="easyui-datebox"></input>
	 <td>结束时间：</td><td><input TYPE="text" NAME="searchenddate" id="searchenddate" style="width:100px"  class="easyui-datebox" ></input></td><td>广告位类型：</td>
	 <td><SELECT NAME="searchtypeid" id="searchtypeid" style="width:100px"><option value="0">──请选择──</option><option value="12">画中画</option>,<option value="11">特型</option>,<option value="10">摩天楼</option>,<option value="9">图片</option>,<option value="8">伸缩通栏</option>,<option value="7">Button</option>,<option value="6">Banner</option>,<option value="5">富媒体</option>,<option value="4">背投广告</option>,<option value="3">文字链</option>,<option value="2">焦点轮播</option>,<option value="1">通栏</option></SELECT></td>
	 <td><a class="easyui-linkbutton" icon="icon-search" onclick="searchres();">搜索</a></td><td><a class="easyui-linkbutton" icon="icon-undo" onclick="undo();">重置</a></td><td><a class="easyui-linkbutton" icon="icon-save" onclick="excel('1');">全部导出</a></td><td><a class="easyui-linkbutton" icon="icon-save" onclick="excel('2');">本页导出</a></td></tr>
	 
	</FORM>
	</table>
	</div>
	<div region="center" border="true"><table id="mytable"></table></div>
</div>
</div>
</body>
</html>